package br.com.sms.util;

import java.util.ArrayList;
import java.util.List;

public class Util {

		
	public String getCodigosDestinatarios(List<Integer> ids){
		StringBuilder builder = new StringBuilder();
		if(ids != null && ids.size() > 0){
			for(int i=0; i < ids.size(); i++){
				if(i == 0){
					builder.append(String.valueOf(ids.get(i)));
				}else{
					builder.append("-"+String.valueOf(ids.get(i)));
				}
			}
		}
		return builder.toString();
	}
	
	public List<Integer> getListIds(String codigo){
		List<Integer> ids = new ArrayList<Integer>();
		String[] array = codigo.split("[-]");
		if(array != null && array.length > 0){
			for (String string : array) {
				ids.add(Integer.parseInt(string));
			}
		}
		return ids;
	}
	
	public static boolean isPreenchido(String string){
		if(string != null && string.trim().length() > 0){
			return true;
		}
		
		return false;
	}
}
